package com.partyjoin.project.system.user.domain;

import java.util.Arrays;
import java.util.Date;

import org.apache.shiro.crypto.SecureRandomNumberGenerator;

import com.partyjoin.framework.aspectj.lang.annotation.Excel;
import com.partyjoin.framework.web.domain.BaseEntity;
import com.partyjoin.project.module.politicalExamine.domain.PoliticalExamine;
import com.partyjoin.project.module.proposer.domain.Proposer;
import com.partyjoin.project.system.dept.domain.Dept;
import com.partyjoin.project.system.role.domain.Role;

/**
 * 用户对象 sys_user
 * 
 * @author partyjoin
 */
public class User extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 用户ID */
    @Excel(name = "用户序号", column = "A")
    private Long userId;
    
    /** 工号/学号 */
    @Excel(name = "学号/工号", column = "B")
    private String jobId;

    /** 部门ID */
    private Long deptId;

    /** 部门父ID */
    private Long parentId;

    /** 登录名称 */
    @Excel(name = "登录名称", column = "C")
    private String loginName;

    /** 用户名称 */
    @Excel(name = "用户名称", column = "D")
    private String userName;

    /** 用户邮箱 */
    @Excel(name = "用户邮箱", column = "E")
    private String email;

    /** 手机号码 */
    @Excel(name = "手机号码", column = "F")
    private String phonenumber;
    
    /** 出生日期*/
    @Excel(name = "出生日期", column = "G")
    private String birthday;

    /** 用户性别 */
    @Excel(name = "用户性别", column = "H")
    private String sex;
    
    /** 年龄 */
    @Excel(name = "年龄", column = "M")
    private Integer age;
    
    /** 身份证号码 */
    @Excel(name = "身份证号码", column = "I")
    private String idCardNo;

    /** 用户头像 */
    private String avatar;

    /** 密码 */
    private String password;

    /** 盐加密 */
    private String salt;

    /** 帐号状态（0正常 1停用） */
    @Excel(name = "帐号状态", column = "J")
    private String status;
    
    /** 个人信息补全状态 用于申请人角色（0未补全 1已补全） */
    private int info_state;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    /** 最后登陆IP */
    @Excel(name = "最后登陆IP", column = "K")
    private String loginIp;

    /** 最后登陆时间 */
    @Excel(name = "最后登陆时间", column = "L")
    private Date loginDate;

    /** 部门对象 */
    private Dept dept;
    
    /** 角色 **/
    private Role role;

    /** 角色组 */
    private Long[] roleIds;

    /** 岗位组 */
    private Long[] postIds;
    
    /** 申请材料对象  */
    private Proposer proposer;
    
    /** 学院  **/
    private String college;
    
    /** 专业 **/
    private String major;

    /** 民族**/
    private String nation;

    /** 籍贯 **/
    private String nativePlace;

    /** 文化程度 **/
     private String educationLevel;

    /** 加入群团时间 **/
    private Date joinTime;

    /** 职务 **/
    private String position;

    /** 政治面貌 **/
    private String political;

    /** 个人简介 **/
    private String introduce;
    
    /** 政审 **/
    private PoliticalExamine politicalExamine;


    public int getInfo_state() {
		return info_state;
	}

	public void setInfo_state(int info_state) {
		this.info_state = info_state;
	}

	public PoliticalExamine getPoliticalExamine() {
		return politicalExamine;
	}

	public void setPoliticalExamine(PoliticalExamine politicalExamine) {
		this.politicalExamine = politicalExamine;
	}

	public String getNation() {
        return nation;
    }

    public void setNation(String nation) {
        this.nation = nation;
    }

    public String getNativePlace() {
        return nativePlace;
    }

    public void setNativePlace(String nativePlace) {
        this.nativePlace = nativePlace;
    }

    public String getEducationLevel() {
        return educationLevel;
    }

    public void setEducationLevel(String educationLevel) {
        this.educationLevel = educationLevel;
    }

    public Date getJoinTime() {
        return joinTime;
    }

    public void setJoinTime(Date joinTime) {
        this.joinTime = joinTime;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public String getPolitical() {
        return political;
    }

    public void setPolitical(String political) {
        this.political = political;
    }

    public String getIntroduce() {
        return introduce;
    }

    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    public String getCollege() {
		return college;
	}

	public void setCollege(String college) {
		this.college = college;
	}

	public String getMajor() {
		return major;
	}

	public void setMajor(String major) {
		this.major = major;
	}

	public Long getUserId()
    {
        return userId;
    }

    public void setUserId(Long userId)
    {
        this.userId = userId;
    }

    public boolean isAdmin()
    {
        return isAdmin(this.userId);
    }

    public static boolean isAdmin(Long userId)
    {
        return userId != null && 1L == userId;
    }

    public Long getDeptId()
    {
        return deptId;
    }

    public void setDeptId(Long deptId)
    {
        this.deptId = deptId;
    }

    public Long getParentId()
    {
        return parentId;
    }

    public void setParentId(Long parentId)
    {
        this.parentId = parentId;
    }

    public String getLoginName()
    {
        return loginName;
    }

    public void setLoginName(String loginName)
    {
        this.loginName = loginName;
    }

    public String getUserName()
    {
        return userName;
    }

    public void setUserName(String userName)
    {
        this.userName = userName;
    }

    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    public String getPhonenumber()
    {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber)
    {
        this.phonenumber = phonenumber;
    }

    public String getSex()
    {
        return sex;
    }

    public void setSex(String sex)
    {
        this.sex = sex;
    }

    public String getAvatar()
    {
        return avatar;
    }

    public void setAvatar(String avatar)
    {
        this.avatar = avatar;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public String getSalt()
    {
        return salt;
    }

    public void setSalt(String salt)
    {
        this.salt = salt;
    }


    /**
     * 生成随机盐
     */
    public void randomSalt()
    {
        // 一个Byte占两个字节，此处生成的3字节，字符串长度为6
        SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
        String hex = secureRandom.nextBytes(3).toHex();
        setSalt(hex);
    }

    public String getStatus()
    {
        return status;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }

    public String getDelFlag()
    {
        return delFlag;
    }

    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }

    public String getLoginIp()
    {
        return loginIp;
    }

    public void setLoginIp(String loginIp)
    {
        this.loginIp = loginIp;
    }

    public Date getLoginDate()
    {
        return loginDate;
    }

    public void setLoginDate(Date loginDate)
    {
        this.loginDate = loginDate;
    }

    public Dept getDept()
    {
        return dept;
    }

    public void setDept(Dept dept)
    {
        this.dept = dept;
    }

    public Long[] getRoleIds()
    {
        return roleIds;
    }

    public void setRoleIds(Long[] roleIds)
    {
        this.roleIds = roleIds;
    }

    public Long[] getPostIds()
    {
        return postIds;
    }

    public void setPostIds(Long[] postIds)
    {
        this.postIds = postIds;
    }

	public String getJobId() {
		return jobId;
	}

	public void setJobId(String jobId) {
		this.jobId = jobId;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
	

	public String getIdCardNo() {
		return idCardNo;
	}

	public void setIdCardNo(String idCardNo) {
		this.idCardNo = idCardNo;
	}
	
	

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	
	public Proposer getProposer() {
		return proposer;
	}

	public void setProposer(Proposer proposer) {
		this.proposer = proposer;
	}
	

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	@Override
	public String toString() {
		return "User [userId=" + userId + ", jobId=" + jobId + ", deptId=" + deptId + ", parentId=" + parentId
				+ ", loginName=" + loginName + ", userName=" + userName + ", email=" + email + ", phonenumber="
				+ phonenumber + ", birthday=" + birthday + ", sex=" + sex + ", age=" + age + ", idCardNo=" + idCardNo
				+ ", avatar=" + avatar + ", password=" + password + ", salt=" + salt + ", status=" + status
				+ ", delFlag=" + delFlag + ", loginIp=" + loginIp + ", loginDate=" + loginDate + ", dept=" + dept
				+ ", roleIds=" + Arrays.toString(roleIds) + ", postIds=" + Arrays.toString(postIds) + ", proposer="
				+ proposer + ", college=" + college + ", major=" + major + ", nation=" + nation + ", nativePlace="
				+ nativePlace + ", educationLevel=" + educationLevel + ", joinTime=" + joinTime + ", position="
				+ position + ", political=" + political + ", introduce=" + introduce + ", politicalExamine="
				+ politicalExamine + "]";
	}

   
}
